import unittest,requests


class wdjk2(unittest.TestCase):

    def setUp(self) -> None:
        print('测试开始')

    def tearDown(self) -> None:
        print('测试结束')

    host = 'http://10.59.9.18'

    # 单接口功能测试用例
    # 用例1：输入的必填参数正确，登录成功
    def test_wdjk_06(self):
        r6 = requests.post(url=wdjk2.host + '/health/doctor/v1/login',
                           data={'email': '2306398720@qq.com',
                                 'pwd': 'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPw'
                                        'h7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lE'
                                        'HvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})

        print(r6.json())
        # 断言
        self.assertEqual('登录成功', r6.json()['message'])

    # 用例2：输入的邮箱账户错误，登录失败
    def test_wdjk_07(self):
        r7 = requests.post(url=wdjk2.host + '/health/doctor/v1/login',
                           data={'email': '2306398720@qq',
                                 'pwd': 'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPw'
                                        'h7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lE'
                                        'HvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})

        print(r7.json())
        # 断言
        self.assertIn('登录失败', r7.json()['message'])

    # 用例3：输入的密码错误，登录失败
    def test_wdjk_08(self):
        r8 = requests.post(url=wdjk2.host + '/health/doctor/v1/login',
                           data={'email': '2306398720@qq.com', 'pwd': 'Dzn6CcyPSJUVIMmCPtCs+zuPw'
                                                                      'h7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lE'
                                                                      'HvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw='})

        print(r8.json())
        # 断言
        self.assertIn('登录失败', r8.json()['message'])

    # 用例4：有未输入的必填参数，登录失败
    def test_wdjk_09(self):
        r9 = requests.post(url=wdjk2.host + '/health/doctor/v1/login',
                           data={'email': '2306398720@qq.com'})

        print(r9.json())
        # 断言
        self.assertTrue(r9.json()['status'])

    # 用例5：多输入一个参数，登录成功
    def test_wdjk_010(self):
        r10 = requests.post(url=wdjk2.host + '/health/doctor/v1/login',
                            data={'email': '2306398720@qq.com',
                                  'pwd': 'lZjdXyj15cOhn1a0yJKsW7o+fw/ogBDzn6CcyPSJUVIMmCPtCs+zuPw'
                                         'h7IZkXZiRhJvvjdIz9D2z1jkMOtD/36ddaLFMtQd9xIk0jAaDP1TH/lE'
                                         'HvvUPwot6asMGMGkH9EgBPT+4eaYC77BGQBPOASweQZE5KDF8BeN/c0sLfSw=',
                                  'page': 1})

        print(r10.json())
        # 断言
        self.assertEqual('登录成功', r10.json()['message'])


if __name__ == '__main__':
    unittest.main()